package com.yuan.aiagent.pgsql;

import com.yuan.aiagent.app.CodeApp;
import com.yuan.aiagent.rag.AppDocumentLoader;
import com.yuan.aiagent.rag.MyDocumentEnricher;
import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import reactor.core.publisher.Flux;

import java.util.List;

@SpringBootTest
public class pgTest1 {

    @Autowired
    private VectorStore vectorStore;
    @Resource
    private AppDocumentLoader appDocumentLoader;
    @Resource
    private MyDocumentEnricher myDocumentEnricher;
    @Resource
    private CodeApp codeApp;
    @Test
    public void test() {
        List markdowns = appDocumentLoader.loadMarkdowns();
        //List enrichedDocuments = myDocumentEnricher.enrichDocumentsByKeyword(markdowns);
        vectorStore.add(markdowns);
    }
    @Test
    public void test1() {
        Flux<String> flux = codeApp.doChatByStream("你好", "1");
        System.out.println(flux);
    }
}
